<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
Auth::routes();

Route::get('/getDownload', 'TestController@getDownload')->name('admin.getDownload');
Route::get('/pdf', 'TestController@pdf')->name('admin.pdf');
Route::delete('/testDelete', 'TestController@testDelete')->name('admin.testDelete');

// easywechat
//Route::any('/wechat', 'WeChatController@serve')->name('api.weixin');

// 微信方面的路由
Route::any('/wechat','WechatController@index');
Route::any('/jssdkconfig','WeChatController@getJSSDKConfig');
Route::any('/getJSConfig','TestWeixinController@getJSConfig');
Route::any('/getInputData','TestController@getInputData');


Route::group([
    'prefix'    => 'admin',
    'namespace' => 'Admin',
], function () {
    Route::get('login', 'LoginController@index')->name('admin.login.get');
    Route::post('login', 'LoginController@login')->name('admin.login.post');
    Route::get('register', 'RegisterController@index')->name('admin.register.get');
    Route::post('register', 'RegisterController@register')->name('admin.register.post');
});

Route::redirect('/', '/admin/login');


Route::group([
    'prefix'    => 'admin',
    'namespace' => 'Admin',
    'middleware' => 'auth',
], function () {
    Route::post('logout', 'LoginController@logout')->name('admin.logout');
    Route::post('test', 'IndexController@test')->name('admin.test');

    Route::get('/', 'IndexController@dashboard')->name('admin.index');
    Route::get('/dashboard', 'IndexController@dashboard')->name('admin.dashboard');

    Route::group(['prefix' => 'user'], function () {
        Route::get('/', 'UserController@index')->name('admin.user.index');
        Route::post('/update', 'UserController@update')->name('admin.user.update');
    });

    Route::group(['prefix' => 'system'], function () {
        Route::post('/tplUpdate', 'SystemController@tplUpdate')->name('admin.system.tpl.update');
    });

    // 基础
    Route::group(['prefix' => 'basic'], function () {

        Route::get('/button', 'BasicController@button')->name('admin.basic.button');
        Route::get('/typography', 'BasicController@typography')->name('admin.basic.typography');
        Route::get('/element', 'BasicController@element')->name('admin.basic.element');

        Route::group(['prefix' => 'layout'], function () {
            Route::get('/normal', 'BasicController@normal')->name('admin.basic.layout.normal');
        });
    });

    // 组件
    Route::group(['prefix' => 'components'], function () {

        Route::get('/{path}', 'ComponentsController@index')->name('admin.components.index');

    });

    // 页面
    Route::group(['prefix' => 'pages'], function () {

        Route::get('/{path}', 'PagesController@index')->name('admin.pages.index');

    });

    Route::resources([
        'user' => 'UserController',
    ]);

    // 个人中心
    Route::resources([
        'profile' => 'ProfileController',
    ]);

//    Route::get('/users', 'UsersController@index')->name('users.index');
//    Route::get('/users/{user}', 'UsersController@show')->name('users.show');
//    Route::get('/users/create', 'UsersController@create')->name('users.create');
//    Route::post('/users', 'UsersController@store')->name('users.store');
//    Route::get('/users/{user}/edit', 'UsersController@edit')->name('users.edit');
//    Route::patch('/users/{user}', 'UsersController@update')->name('users.update');
//    Route::delete('/users/{user}', 'UsersController@destroy')->name('users.destroy');

});




